var mysql = require("mysql");

// 创建连接
var connection = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "root",
    port: 3306,
    database: "jeecg"
});
// 连接数据库
connection.connect();
// 执行数据操作
// connection.query('sql 语句')
connection.query("SELECT 1 + 1 AS solution", function (error, results, fields) {
    if (error) throw error;
    console.log("The solution is: ", results[0].solution);
});
// 关闭连接
connection.end();
